package com.eyaomall.wxmall.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.eyaomall.wxmall.dao.EmployeeDao;
import com.eyaomall.wxmall.model.po.Employee;
import com.eyaomall.wxmall.service.EmployeeService;
import com.lycheeframework.core.cmp.kit.PageHTTPObject;
import com.lycheeframework.core.cmp.kit.Pages;

@Service
public class EmployeeServiceImpl implements EmployeeService {

	@Autowired
	private EmployeeDao employeeDao;

	/**
	 * 查询门店店员信息
	 */
	public Pages<?> page(Employee employee, PageHTTPObject httpObject) {

		return employeeDao.page(employee, httpObject);
	}

	/**
	 * 删除店员
	 */
	public boolean deleteById(Employee employee) {
		
		return employeeDao.deleteById(employee);
	}

	/**
	 * 查询门店店长
	 */
	public Employee queryByJobName(Employee employee) {
		return employeeDao.queryByJobName(employee);
	}

	/**
	 * 修改店长
	 */
	public boolean updateByJobName(Employee employee) {
		return employeeDao.updateByJobName(employee);
	}

	/**
	 * 修改店员信息
	 */
	public boolean update(Employee employee) {
		return employeeDao.update(employee);
	}

	/**
	 * 新增店员
	 */
	public int create(Employee employee) {
		return employeeDao.create(employee);
	}

	/**
	 * 通过ID查询店员
	 */
	public Employee queryById(Integer id) {
		return employeeDao.queryById(id);
	}

	/**
	 * 登录校验
	 * @param phone
	 * @param passwd
	 * @return
	 */
	public Employee login(String phone,String passwd){
		Employee employee = new Employee();
		employee.setPhone(phone);
		employee.setPasswd(passwd);
		
		return (Employee) employeeDao.query("login",employee);
	}
	
	/**
	 * 通过ID查询店员
	 */
	public Employee queryByPhone(String phone){
		Employee employee = new Employee();
		employee.setPhone(phone);
		
		return (Employee) employeeDao.query(employee);
		
	}
}
